package com.gcsoftware.web.beans.elasticsearchData;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.io.Serializable;
import java.util.List;

/**
 * ES返回实体类
 * @author czp
 * date : 2018-03-31
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Agg<T> implements Serializable {
    @JsonProperty("buckets")
    private List<T> buckets;

    @JsonProperty("doc_count_error_upper_bound")
    private int doc_count_error_upper_bound;

    @JsonProperty("sum_other_doc_count")
    private int sum_other_doc_count;

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
            .append("buckets", buckets)
            .append("doc_count_error_upper_bound", doc_count_error_upper_bound)
            .append("sum_other_doc_count", sum_other_doc_count)
            .toString();
    }

    public List<T> getBuckets() {
        return buckets;
    }

    public void setBuckets(List<T> buckets) {
        this.buckets = buckets;
    }

    public int getDoc_count_error_upper_bound() {
        return doc_count_error_upper_bound;
    }

    public void setDoc_count_error_upper_bound(int doc_count_error_upper_bound) {
        this.doc_count_error_upper_bound = doc_count_error_upper_bound;
    }

    public int getSum_other_doc_count() {
        return sum_other_doc_count;
    }

    public void setSum_other_doc_count(int sum_other_doc_count) {
        this.sum_other_doc_count = sum_other_doc_count;
    }
}
